/*   1:    */ package org.jetbrains.jps.model.artifact.impl;
/*   2:    */ 
/*   3:    */

import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.text.StringUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.JpsElement;
import org.jetbrains.jps.model.JpsElementChildRole;
import org.jetbrains.jps.model.artifact.JpsArtifact;
import org.jetbrains.jps.model.artifact.JpsArtifactType;
import org.jetbrains.jps.model.artifact.elements.JpsArchivePackagingElement;
import org.jetbrains.jps.model.artifact.elements.JpsCompositePackagingElement;
import org.jetbrains.jps.model.ex.JpsElementChildRoleBase;
import org.jetbrains.jps.model.ex.JpsNamedCompositeElementBase;

/*   4:    */
/*   5:    */
/*   6:    */
/*   7:    */
/*   8:    */
/*   9:    */
/*  10:    */
/*  11:    */
/*  12:    */
/*  13:    */
/*  14:    */
/*  15:    */
/*  16:    */ 
/*  17:    */ public class JpsArtifactImpl<P extends JpsElement>
/*  18:    */   extends JpsNamedCompositeElementBase<JpsArtifactImpl<P>>
/*  19:    */   implements JpsArtifact
/*  20:    */ {
/*  21: 36 */   private static final JpsElementChildRole<JpsCompositePackagingElement> a = JpsElementChildRoleBase.create("root element");
/*  22:    */   private final JpsArtifactType<P> b;
/*  23:    */   private String c;
/*  24:    */   private boolean d;
/*  25:    */   
/*  26:    */   public JpsArtifactImpl(@NotNull String paramString, @NotNull JpsCompositePackagingElement paramJpsCompositePackagingElement, @NotNull JpsArtifactType<P> paramJpsArtifactType, @NotNull P paramP)
/*  27:    */   {
/*  28: 43 */     super(paramString);
/*  29: 44 */     this.b = paramJpsArtifactType;
/*  30: 45 */     this.myContainer.setChild(a, paramJpsCompositePackagingElement);
/*  31: 46 */     this.myContainer.setChild(paramJpsArtifactType.getPropertiesRole(), paramP);
/*  32:    */   }
/*  33:    */   
/*  34:    */   private JpsArtifactImpl(JpsArtifactImpl<P> paramJpsArtifactImpl)
/*  35:    */   {
/*  36: 50 */     super(paramJpsArtifactImpl);
/*  37: 51 */     this.b = paramJpsArtifactImpl.b;
/*  38: 52 */     this.c = paramJpsArtifactImpl.c;
/*  39:    */   }
/*  40:    */   
/*  41:    */   @NotNull
/*  42:    */   public JpsArtifactImpl<P> createCopy()
/*  43:    */   {
/*  44: 58 */     void tmp8_5 = new JpsArtifactImpl(this);
/*  45: 58 */     if (tmp8_5 == null) {
/*  46: 58 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/jps/model/artifact/impl/JpsArtifactImpl", "createCopy" }));
/*  47:    */     }
/*  48: 58 */     return tmp8_5;
/*  49:    */   }
/*  50:    */   
/*  51:    */   public String getOutputPath()
/*  52:    */   {
/*  53: 62 */     return this.c;
/*  54:    */   }
/*  55:    */   
/*  56:    */   public void setOutputPath(@Nullable String paramString)
/*  57:    */   {
/*  58: 66 */     if (!Comparing.equal(this.c, paramString))
/*  59:    */     {
/*  60: 67 */       this.c = paramString;
/*  61: 68 */       fireElementChanged();
/*  62:    */     }
/*  63:    */   }
/*  64:    */   
/*  65:    */   @Nullable
/*  66:    */   public String getOutputFilePath()
/*  67:    */   {
/*  68: 75 */     if (StringUtil.isEmpty(this.c)) {
/*  69: 75 */       return null;
/*  70:    */     }
/*  71: 76 */     JpsCompositePackagingElement localJpsCompositePackagingElement = getRootElement();
/*  72: 77 */     return (localJpsCompositePackagingElement instanceof JpsArchivePackagingElement) ? this.c + "/" + ((JpsArchivePackagingElement)localJpsCompositePackagingElement).getArchiveName() : this.c;
/*  73:    */   }
/*  74:    */   
/*  75:    */   @NotNull
/*  76:    */   public JpsArtifactType<P> getArtifactType()
/*  77:    */   {
/*  78: 83 */     JpsArtifactType tmp4_1 = this.b;
/*  79: 83 */     if (tmp4_1 == null) {
/*  80: 83 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/jps/model/artifact/impl/JpsArtifactImpl", "getArtifactType" }));
/*  81:    */     }
/*  82: 83 */     return tmp4_1;
/*  83:    */   }
/*  84:    */   
/*  85:    */   @NotNull
/*  86:    */   public JpsArtifactReferenceImpl createReference()
/*  87:    */   {
/*  88: 89 */     void tmp11_8 = new JpsArtifactReferenceImpl(getName());
/*  89: 89 */     if (tmp11_8 == null) {
/*  90: 89 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/jps/model/artifact/impl/JpsArtifactImpl", "createReference" }));
/*  91:    */     }
/*  92: 89 */     return tmp11_8;
/*  93:    */   }
/*  94:    */   
/*  95:    */   @NotNull
/*  96:    */   public JpsCompositePackagingElement getRootElement()
/*  97:    */   {
/*  98: 95 */     JpsCompositePackagingElement tmp13_10 = ((JpsCompositePackagingElement)this.myContainer.getChild(a));
/*  99: 95 */     if (tmp13_10 == null) {
/* 100: 95 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/jps/model/artifact/impl/JpsArtifactImpl", "getRootElement" }));
/* 101:    */     }
/* 102: 95 */     return tmp13_10;
/* 103:    */   }
/* 104:    */   
/* 105:    */   public void setRootElement(@NotNull JpsCompositePackagingElement paramJpsCompositePackagingElement)
/* 106:    */   {
/* 107:100 */     if (paramJpsCompositePackagingElement == null) {
/* 108:100 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/jps/model/artifact/impl/JpsArtifactImpl", "setRootElement" }));
/* 109:    */     }
/* 110:100 */     this.myContainer.setChild(a, paramJpsCompositePackagingElement);
/* 111:    */   }
/* 112:    */   
/* 113:    */   public P getProperties()
/* 114:    */   {
/* 115:105 */     return this.myContainer.getChild(this.b.getPropertiesRole());
/* 116:    */   }
/* 117:    */   
/* 118:    */   public boolean isBuildOnMake()
/* 119:    */   {
/* 120:110 */     return this.d;
/* 121:    */   }
/* 122:    */   
/* 123:    */   public void setBuildOnMake(boolean paramBoolean)
/* 124:    */   {
/* 125:115 */     if (this.d != paramBoolean)
/* 126:    */     {
/* 127:116 */       this.d = paramBoolean;
/* 128:117 */       fireElementChanged();
/* 129:    */     }
/* 130:    */   }
/* 131:    */ }



/* Location:           E:\idea\

 * Qualified Name:     org.jetbrains.jps.model.artifact.impl.JpsArtifactImpl

 * JD-Core Version:    0.7.0.1

 */